@media (max-width: 768px) {
    :root {
        --login-bg: #0f1414;
        --login-card-off: rgba(255, 255, 255, 0.04);
        --login-card-on: rgba(255, 255, 255, 0.08);
        --login-border-off: rgba(255, 255, 255, 0.07);
        --login-border-on: rgba(255, 255, 255, 0.12);
        --login-text: #f6f1e7;
        --login-muted: rgba(255, 255, 255, 0.68);
        --gold-soft: #c79f61;
    }

    body {
        min-height: 100dvh;
        height: auto !important;
        padding: 88px 18px 28px;
        box-sizing: border-box;
        align-items: flex-start;
        overflow-x: hidden;
        overflow-y: auto !important;
        background:
            radial-gradient(circle at top center, rgba(179, 139, 89, 0.18) 0%, rgba(179, 139, 89, 0) 32%),
            linear-gradient(180deg, #101515 0%, #161c1c 100%);
    }

    .scene {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 26px;
        position: relative;
    }

    .lamp-container {
        width: 100%;
        display: flex;
        justify-content: center;
        padding-top: 8px;
    }

    .lamp {
        width: 108px;
        transform: scale(1);
        transform-origin: top center;
    }

    .lamp-head {
        width: 108px;
        height: 54px;
        border-radius: 60px 60px 10px 10px;
    }

    .lamp-stick {
        width: 8px;
        height: 78px;
        margin-top: -3px;
    }

    .lamp-base {
        width: 58px;
        height: 8px;
        margin-top: -3px;
    }

    .pull-cord {
        width: 2px;
        height: 52px;
        right: 28px;
        top: 48px;
    }

    .cord-handle {
        width: 12px;
        height: 12px;
        left: -5px;
        bottom: -6px;
    }

    .light-ray {
        width: 240px;
        height: 240px;
        top: 35%;
        background: radial-gradient(circle, rgba(255, 251, 230, 0.22) 0%, rgba(255, 251, 230, 0) 68%);
    }

    .login-container {
        width: 100%;
        max-width: 360px;
        opacity: 0; /* Diubah jadi 0 agar benar-benar tidak kelihatan saat mati */
        transform: translateY(15px); /* Memberikan efek turun sedikit saat mati */
        pointer-events: none;
        user-select: none;
        background: var(--login-card-off);
        border: 1px solid var(--login-border-off);
        border-radius: 24px;
        padding: 24px 18px 20px;
        box-sizing: border-box;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow:
            0 24px 50px rgba(0, 0, 0, 0.20),
            inset 0 1px 0 rgba(255, 255, 255, 0.04);
        transition:
            opacity 0.4s ease,
            transform 0.4s ease,
            box-shadow 0.35s ease,
            background 0.35s ease,
            border-color 0.35s ease,
            filter 0.35s ease;
        filter: grayscale(0.3);
    }

    .login-container input,
    .login-container button {
        pointer-events: none;
    }

    .scene.is-on .login-container {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
        user-select: auto;
        background: var(--login-card-on);
        border: 1px solid var(--login-border-on);
        box-shadow:
            0 24px 50px rgba(0, 0, 0, 0.28),
            inset 0 1px 0 rgba(255, 255, 255, 0.06);
        filter: none;
    }

    .scene.is-on .login-container input,
    .scene.is-on .login-container button {
        pointer-events: auto;
    }

    .login-container h1 {
        margin: 0 0 18px;
        color: var(--login-text);
        font-size: 28px;
        line-height: 1.15;
        font-weight: 700;
        text-align: center;
        letter-spacing: 0.2px;
        transition: opacity 0.35s ease, filter 0.35s ease;
    }

    .login-container::before {
        content: "LOGIN ADMIN";
        display: block;
        text-align: center;
        color: var(--gold-soft);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 2px;
        margin-bottom: 10px;
        transition: opacity 0.35s ease, filter 0.35s ease;
    }

    .scene:not(.is-on) .login-container h1,
    .scene:not(.is-on) .login-container::before {
        opacity: 0.7;
        filter: grayscale(0.4);
    }

    .inputs {
        display: grid;
        gap: 12px;
    }

    .inputs input {
        width: 100%;
        min-height: 52px;
        margin: 0;
        padding: 0 16px;
        box-sizing: border-box;
        border-radius: 14px;
        border: 1px solid rgba(255, 255, 255, 0.10);
        background: rgba(255, 255, 255, 0.07);
        color: #ffffff;
        font-size: 15px;
        outline: none;
        box-shadow: none;
        transition:
            opacity 0.35s ease,
            filter 0.35s ease,
            border-color 0.25s ease,
            background 0.25s ease,
            box-shadow 0.25s ease;
    }

    .scene:not(.is-on) .inputs input {
        opacity: 0.6;
        filter: grayscale(0.45);
    }

    .inputs input::placeholder {
        color: rgba(255, 255, 255, 0.48);
    }

    .inputs input:focus {
        border-color: rgba(199, 159, 97, 0.7);
        background: rgba(255, 255, 255, 0.09);
        box-shadow: 0 0 0 4px rgba(199, 159, 97, 0.12);
    }

    .sign-in {
        width: 100%;
        min-height: 52px;
        margin-top: 16px;
        border: none;
        border-radius: 14px;
        background: linear-gradient(135deg, #c79f61 0%, #ab7f45 100%);
        color: #ffffff;
        font-size: 15px;
        font-weight: 700;
        letter-spacing: 0.2px;
        box-shadow: 0 14px 28px rgba(179, 139, 89, 0.24);
        transition: opacity 0.35s ease, filter 0.35s ease, transform 0.2s ease;
    }

    .scene:not(.is-on) .sign-in {
        opacity: 0.6;
        filter: grayscale(0.45);
    }

    .sign-in:active {
        transform: scale(0.985);
    }

    .pesan-error {
        margin: 0 0 14px;
        padding: 12px 14px;
        border-radius: 14px;
        background: rgba(255, 64, 64, 0.12);
        border: 1px solid rgba(255, 64, 64, 0.24);
        color: #ff8a8a;
        font-size: 13px;
        line-height: 1.5;
        text-shadow: none;
        letter-spacing: 0.2px;
        transition: opacity 0.35s ease, filter 0.35s ease;
    }

    .scene:not(.is-on) .pesan-error {
        opacity: 0.65;
        filter: grayscale(0.3);
    }

    .back-btn {
        position: fixed;
        top: 18px;
        left: 16px;
        padding: 10px 14px;
        gap: 7px;
        font-size: 13px;
        color: #ded8ce;
        background: rgba(18, 18, 18, 0.42);
        border: 1px solid rgba(255, 255, 255, 0.10);
        border-radius: 999px;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    }

    .back-icon {
        font-size: 16px;
    }

    .back-btn:hover,
    .back-btn:active {
        color: #fff3de;
        background: rgba(179, 139, 89, 0.16);
        border-color: rgba(199, 159, 97, 0.48);
        transform: none !important;
        box-shadow: 0 10px 22px rgba(179, 139, 89, 0.18);
    }

    #backBtn {
        transition: color 0.25s, background 0.25s, box-shadow 0.25s, border-color 0.25s !important;
    }

    .scene.is-on .lamp-head {
        box-shadow: 0 0 34px rgba(255, 251, 230, 0.28);
    }

    .scene.is-on .light-ray {
        opacity: 1;
    }
}

@media (max-width: 420px) {
    body {
        padding: 84px 14px 24px;
    }

    .scene {
        gap: 22px;
    }

    .lamp {
        width: 96px;
    }

    .lamp-head {
        width: 96px;
        height: 48px;
    }

    .lamp-stick {
        height: 72px;
    }

    .pull-cord {
        right: 24px;
        top: 44px;
        height: 48px;
    }

    .login-container {
        border-radius: 22px;
        padding: 22px 16px 18px;
    }

    .login-container h1 {
        font-size: 25px;
        margin-bottom: 16px;
    }

    .inputs input,
    .sign-in {
        min-height: 50px;
    }
}

/* =========================
   OVERRIDE ANTI REFRESH SAAT NARIK LAMPU
   tempel paling bawah
   ========================= */

@media (max-width: 768px) {
    html,
    body {
        overscroll-behavior-y: none;
    }

    .scene,
    .lamp-container,
    .lamp,
    .pull-cord,
    .cord-handle {
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

@media (max-width: 768px) {
    .back-btn,
    #backBtn {
        display: none !important;
    }
}


/* =========================================
   MOBILE OVERRIDE - CAHAYA LEBIH HALUS
   ========================================= */
@media screen and (max-width: 768px) {
  body {
    background:
      radial-gradient(circle at center, #050606 0%, #010202 62%, #000000 100%) !important;
    position: relative;
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    pointer-events: none;
    z-index: 0;
    transition: background 0.45s ease;
  }

  .scene {
    position: relative;
    z-index: 2;
  }

  /* ambience seluruh ruangan */
  .scene::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    z-index: 1;
    transition: opacity 0.5s ease;
    background:
      radial-gradient(circle at 50% 18%,
        rgba(255, 231, 180, 0.09) 0%,
        rgba(255, 220, 155, 0.05) 22%,
        rgba(255, 210, 140, 0.025) 42%,
        transparent 72%),
      radial-gradient(circle at 50% 50%,
        rgba(255, 220, 150, 0.018) 0%,
        transparent 70%);
  }

  .scene.is-on::before {
    opacity: 1;
  }

  /* hapus cahaya lama yang bikin bentuk aneh */
  .light-ray {
    position: fixed !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    clip-path: none !important;
    filter: none !important;
    opacity: 0 !important;
    pointer-events: none;
    z-index: 1 !important;
    transition: opacity 0.45s ease !important;
    background:
      radial-gradient(ellipse at 50% 16%,
        rgba(255, 236, 190, 0.07) 0%,
        rgba(255, 226, 165, 0.035) 20%,
        rgba(255, 216, 145, 0.015) 38%,
        transparent 62%) !important;
  }

  .scene.is-on .light-ray {
    opacity: 1 !important;
  }

  /* hilangkan bulatan bohlam yang ganggu */
  .lamp::before {
    display: none !important;
    content: none !important;
  }

  .lamp-head {
    position: relative !important;
    overflow: hidden !important;
    background: linear-gradient(to bottom, #2a2a2a, #151515) !important;
  }

  /* glow dalam kap lampu */
  .scene.is-on .lamp-head::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 4px;
    transform: translateX(-50%);
    width: 78px;
    height: 18px;
    border-radius: 0 0 60px 60px;
    background: radial-gradient(
      ellipse at center,
      rgba(255, 242, 205, 0.14) 0%,
      rgba(255, 228, 165, 0.07) 52%,
      rgba(255, 214, 145, 0.02) 78%,
      transparent 100%
    ) !important;
    filter: blur(6px);
    pointer-events: none;
    z-index: 2;
  }

  /* aura luar kap lampu, lembut banget */
  .scene.is-on .lamp-head::after {
    content: "";
    position: absolute;
    left: 50%;
    top: -8px;
    transform: translateX(-50%);
    width: 120px;
    height: 58px;
    border-radius: 90px 90px 16px 16px;
    background: radial-gradient(
      ellipse at center,
      rgba(255, 236, 185, 0.08) 0%,
      rgba(255, 223, 155, 0.04) 46%,
      rgba(255, 208, 132, 0.015) 74%,
      transparent 90%
    ) !important;
    filter: blur(10px);
    pointer-events: none;
    z-index: -1;
  }

  .scene.is-on .lamp-head {
    background: linear-gradient(to bottom, #4b4334, #1d1914) !important;
    box-shadow: 0 0 12px rgba(255, 223, 155, 0.05) !important;
  }

  /* login card tetap remang, bukan kesorot keras */
  .login-container {
    position: relative;
    z-index: 3;
  }

  .scene.is-on .login-container {
    box-shadow:
      0 14px 34px rgba(0, 0, 0, 0.45),
      0 0 18px rgba(255, 220, 145, 0.025) !important;
  }

  /* ERROR - lampu rusak / korslet */
  @keyframes lamp-flicker-mobile {
    0%, 100% { opacity: 1; }
    12% { opacity: 0.32; }
    24% { opacity: 1; }
    38% { opacity: 0.18; }
    52% { opacity: 0.94; }
    66% { opacity: 0.22; }
    80% { opacity: 1; }
  }

  .scene.is-error::before {
    opacity: 1 !important;
    background:
      radial-gradient(circle at 50% 16%,
        rgba(255, 90, 90, 0.12) 0%,
        rgba(255, 60, 60, 0.06) 22%,
        rgba(255, 40, 40, 0.025) 42%,
        transparent 70%) !important;
    animation: lamp-flicker-mobile 0.2s infinite;
  }

  .scene.is-error .light-ray {
    opacity: 1 !important;
    background:
      radial-gradient(circle at 50% 16%,
        rgba(255, 120, 120, 0.12) 0%,
        rgba(255, 80, 80, 0.06) 22%,
        rgba(255, 45, 45, 0.025) 42%,
        transparent 70%) !important;
    animation: lamp-flicker-mobile 0.2s infinite;
  }

  .scene.is-error .lamp-head {
    background: linear-gradient(to bottom, #5e1717, #250909) !important;
    box-shadow: 0 0 18px rgba(255, 60, 60, 0.18) !important;
    animation: lamp-flicker-mobile 0.2s infinite;
  }

  .scene.is-error .lamp-head::before,
  .scene.is-error .lamp-head::after {
    background: radial-gradient(
      ellipse at center,
      rgba(255, 185, 185, 0.12) 0%,
      rgba(255, 90, 90, 0.06) 48%,
      rgba(255, 50, 50, 0.02) 76%,
      transparent 100%
    ) !important;
    animation: lamp-flicker-mobile 0.2s infinite;
  }
}


/* =========================================
   MOBILE OVERRIDE - CAHAYA LEBIH HALUS & NATURAL
   ========================================= */
@media screen and (max-width: 768px) {
  body {
    background: radial-gradient(circle at center, #050606 0%, #010202 62%, #000000 100%) !important;
    position: relative;
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95); /* Ruangan dibuat lebih gelap gulita */
    pointer-events: none;
    z-index: 0;
    transition: background 0.45s ease;
  }

  .scene {
    position: relative;
    z-index: 2;
  }

  /* AMBIENCE NORMAL: Cahaya pendaran tipis ke seluruh ruangan */
  .scene::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    z-index: 1;
    transition: opacity 0.5s ease;
    background:
      radial-gradient(circle at 50% 18%,
        rgba(255, 231, 180, 0.06) 0%,
        rgba(255, 220, 155, 0.03) 25%,
        transparent 70%);
  }

  .scene.is-on::before {
    opacity: 1;
  }

  /* CAHAYA SOROT NORMAL (Light Ray): Fokus ke bawah seperti lampu asli */
  .light-ray {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    clip-path: none !important;
    filter: none !important;
    opacity: 0 !important;
    pointer-events: none;
    z-index: 1 !important;
    transition: opacity 0.4s ease !important;
    background:
      radial-gradient(ellipse at 50% 16%,
        rgba(255, 236, 190, 0.12) 0%,
        rgba(255, 226, 165, 0.06) 20%,
        rgba(255, 216, 145, 0.02) 40%,
        transparent 65%) !important;
  }

  .scene.is-on .light-ray {
    opacity: 1 !important;
  }

  /* Hilangkan bulatan bohlam bawaan */
  .lamp::before {
    display: none !important;
  }

  /* KAP LAMPU NORMAL */
  .lamp-head {
    position: relative !important;
    background: linear-gradient(to bottom, #2a2a2a, #151515) !important;
  }

  .scene.is-on .lamp-head {
    background: linear-gradient(to bottom, #4b4334, #1d1914) !important;
    box-shadow: 0 0 12px rgba(255, 223, 155, 0.05) !important;
  }

  /* Tampilan form saat nyala */
  .login-container {
    position: relative;
    z-index: 3;
  }

  .scene.is-on .login-container {
    box-shadow:
      0 14px 34px rgba(0, 0, 0, 0.45),
      0 0 18px rgba(255, 220, 145, 0.025) !important;
  }

}


/* ==========================================================================
   MOBILE OVERRIDE - TANPA TITIK CAHAYA (MURNI PENDARAN HALUS)
   ========================================================================== */
@media (max-width: 768px) {
    
    /* Memastikan fisik lampu aman berada di lapisan depan tanpa tembus */
    .lamp-container {
        position: relative !important;
        z-index: 5 !important;
    }

    /* 1. KONDISI AWAL: Form benar-benar GAIB/HILANG TOTAL saat lampu mati */
    .login-container {
        opacity: 0 !important;
        pointer-events: none !important;
        user-select: none !important;
        transform: translateY(25px) scale(0.96);
        transition: 
            opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
            transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    }

    /* 2. KONDISI NYALA: Form muncul dengan anggun saat lampu ditarik */
    .scene.is-on .login-container,
    .scene.is-error .login-container,
    .scene.is-exploded .login-container {
        opacity: 1 !important;
        pointer-events: all !important;
        user-select: auto !important;
        transform: translateY(0) scale(1);
    }

    /* ==================================================================
       EFEK CAHAYA LAMPU NORMAL (KUNING - SEBARAN HALUS TANPA INTI TITIK)
       ================================================================== */
    
    /* Pendaran Ruangan Belakang (Ambient Room Glow) */
    .scene::before {
        content: "";
        position: fixed;
        inset: 0;
        pointer-events: none;
        opacity: 0;
        z-index: 1;
        transition: opacity 0.6s ease;
        background: radial-gradient(circle at 50% 80px,
            rgba(255, 224, 140, 0.05) 0%,
            rgba(212, 163, 89, 0.01) 50%,
            transparent 75%) !important;
    }
    .scene.is-on::before { opacity: 1; }

    /* Sorot Utama Lampu (Main Light Beam) */
    .light-ray {
        position: fixed !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        clip-path: none !important;
        filter: none !important;
        opacity: 0 !important;
        pointer-events: none;
        z-index: 1 !important;
        transition: opacity 0.5s ease !important;
        /* KUNCI PERBAIKAN: Titik putih tajam DIHAPUS, langsung sebaran warna transparan lembut */
        background: radial-gradient(ellipse at 50% 800px,
            rgba(255, 215, 130, 0.38) 0%,    /* Langsung mulai dari kuning transparan tipis */
            rgba(224, 168, 84, 0.15) 25%,    /* Memudar halus ke bawah */
            rgba(179, 139, 89, 0.04) 55%,    /* Sisa pendaran luar */
            transparent 75%) !important;
    }
    .scene.is-on .light-ray { opacity: 1 !important; }


    /* ==================================================================
       EFEK CAHAYA MODE DARURAT (MERAH - SEBARAN HALUS TANPA INTI TITIK)
       ================================================================== */
    
    @keyframes smooth-flicker {
        0%, 100% { opacity: 1; }
        45% { opacity: 0.92; }
        50% { opacity: 0.35; }
        54% { opacity: 0.85; }
        58% { opacity: 0.20; }
        64% { opacity: 0.95; }
        82% { opacity: 0.90; }
        86% { opacity: 0.40; }
        90% { opacity: 1; }
    }

    /* Ambient Room Glow Warna Merah */
    .scene.is-error::before,
    .scene.is-exploded::before {
        opacity: 1 !important;
        background: radial-gradient(circle at 50% 80px,
            rgba(255, 40, 40, 0.06) 0%,
            rgba(150, 10, 10, 0.01) 50%,
            transparent 75%) !important;
        animation: smooth-flicker 0.4s infinite;
    }

    /* Sorot Utama Lampu Merah */
    .scene.is-error .light-ray,
    .scene.is-exploded .light-ray {
        opacity: 1 !important;
        /* KUNCI PERBAIKAN: Titik merah-putih tajam DIHAPUS, langsung pendaran merah bioskop */
        background: radial-gradient(ellipse at 50% 800px,
            rgba(255, 40, 40, 0.35) 0%,     /* Langsung mulai dari merah transparan halus */
            rgba(180, 20, 20, 0.14) 28%,     /* Memudar secara bertahap */
            rgba(90, 5, 5, 0.03) 55%,        /* Ujung pendaran tipis */
            transparent 75%) !important;
        animation: smooth-flicker 0.4s infinite;
    }

    /* Warna Kap Lampu saat Darurat */
    .scene.is-error .lamp-head,
    .scene.is-exploded .lamp-head {
        background: linear-gradient(to bottom, #5a0f0f, #220505) !important;
        box-shadow: 0 0 15px rgba(255, 40, 40, 0.15) !important;
    }

    /* Menaikkan sedikit icon mata di HP saat mode darurat agar sejajar */
    .scene.is-exploded .toggle-password {
        transform: translateY(calc(-50% - 8px)) !important;
    }
}